class Solution(object):
    def getMinDistance(self, nums, target, start):
        dist = 0
        n = len(nums)
        while True:
            if start + dist < n:
                if nums[start + dist] == target:
                    return dist
            if start - dist >= 0:
                if nums[start - dist] == target:
                    return dist
            dist += 1
